
$(function () {

    var appId = $("#appId").val();
    var reads = window.localStorage.getItem("appReads");
    reads = JSON.parse(reads);
    if(reads == null){
        reads = [];
        reads.push(appId);
        window.localStorage.setItem("appReads",JSON.stringify(reads));
        readCount(appId);
    }else{
        if(reads.indexOf(appId) == -1){
            //没有阅读过，阅读量+1
            reads.push(appId);
            window.localStorage.setItem("appReads",JSON.stringify(reads));
            readCount(appId);
        }
    }
})


function readCount(appId){
    //保存项目
    $.ajax({
        url:"/app/updateCount",
        type:"POST",
        data: {
            appId:appId
        },
        // contentType:"application/json;charset=utf-8",
        success:function (result) {

        },
        error:function (res) {
            console.log(res);
        }
    });
}


